﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 2;
            int[,] a = new int[2, 2];

            Console.WriteLine("Вводим массив");
            for (int i = 0; i < n; ++i)
            {
                for (int j = 0; j < n; ++j)
                {
                    Console.Write("a[{0},{1}]=", i, j);
                    a[i, j] = int.Parse(Console.ReadLine());
                }
            }
            Console.WriteLine("Выводим массив");
            int sum = 0;
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (i == j)
                    {
                    sum=a[i,j];
                    sum += a[i, j];
                    a[i, i] = sum;
                    }
                    Console.Write(a[i, j] + "  ");
                }
                Console.WriteLine();
                
            }
            Console.ReadLine();
            //Console.WriteLine(sum);
        }
    }
}
              